import { request } from "@/utils/service"
import type * as Certificate from "./types"

/** 增 */
export function createCertificateApi(data: Certificate.CreateOrUpdateCertificateRequestData) {
  return request({
    url: "certificate",
    method: "post",
    data
  })
}

/** 删 */
export function deleteCertificateApi(id: string) {
  return request({
    url: `certificate/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updateCertificateApi(data: Certificate.CreateOrUpdateCertificateRequestData) {
  return request({
    url: "certificate/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getCertificateApi(params: Certificate.GetCertificateRequestData) {
  return request<Certificate.GetCertificateResponseData>({
    url: "certificate",
    method: "get",
    params
  })
}

/** 查详情 */
export function getCertificateDetailApi(id: string) {
  return request<Certificate.GetCertificateResponeseDetailData>({
    url: `certificate/${id}`,
    method: "get"
  })
}
